import {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot} from "@angular/router";
export class LoginGuard implements CanActivate {
    canActivate() {
        //用这个变量表示,用户是否登录
        let num: number = Math.random();
        let loggedIn: boolean = num < 0.5;
        if (loggedIn) {
            alert(`num : ${num} , 可以进入`);
        } else {
            alert(`num : ${num}, 没有权限进入`);
        }
        return loggedIn;
    }
}
    